<template>
  <div class="specContainer" >
    <div class="content-wrapper" ref="specWrapper">
      <div>
        <div class="catygoryContainer">
          <div v-for="(item,index) in Categorys" :key="index" class="categoryItem">
            <img :src="item.src" class="categoryImage" />
            <p class="categoryTitle">{{item.name}}</p>
          </div>
        </div>
        <div class="activity">
          <ActivityList />
        </div>
        <div class="goods">
          <GoodsList />
        </div>
      </div>
    </div>
  </div>

</template>

<script>
/* eslint-disable semi,no-unused-vars */
import axios from 'axios';
import BScroll from 'better-scroll'
import ActivityList from '../../components/widget/ActivityList';
import GoodsList from '../../components/widget/GoodList';

export default {
  name: 'specialSale',
  components: {
    ActivityList,
    GoodsList,
  },
  data() {
    return {
      Categorys: [
        { name: '分类', src: 'static/icon/type.jpg' },
        { name: '签到', src: 'static/icon/sign.jpg' },
        { name: '凑团', src: 'static/icon/tuan.jpg' },
        { name: '宝箱', src: 'static/icon/box.jpg' },
        { name: '颜值贷', src: 'static/icon/money.jpg' },
      ],
    };
  },
  methods: {
    initScroll() {
      this.specScroll = new BScroll(this.$refs.specWrapper, {
        click: true,
        probeType: 3,
      })
    },
  },
  computed: {
    getListChange() {
      return this.$store.state.listChange;
    },
  },
  watch: {
    getListChange(curVal, oldVal) {
      console.log('----getListChange---');
      // if (curVal) {
      //   this.$nextTick(() => {
      //     this.initScroll()
      //   })
      // }
    },
  },
  created() {
    this.$nextTick(() => {
      this.initScroll();
    });
  },

};
</script>

<style scoped>
  .specContainer {
    margin-top: 0.5rem;
    display: flex;
    width: 100%;
    height: 90%;
    margin-bottom: 0.5rem;
    overflow: hidden;
    position: absolute;
  }
  .content-wrapper {
    flex: 1;
    height: 18rem;
    display: flex;
    flex-direction: column;
  }
  .catygoryContainer {
    display: flex;
    height: 4rem;
    width: 85%;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
  }
  .categoryItem {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .categoryImage{
    height: 2.3rem;
    width: 2.3rem;
  }
  .categoryTitle {
    margin-top: 0.32rem;
    font-size: 0.42rem;
  }
  .activity {
    display: flex;
    flex: none;
    height: 6rem;
    position:relative;
  }
  .goods {
    display: flex;
    margin-top: 0.5rem;
    position:relative;
  }
</style>
